<template>
  <el-table :data="students" style="width: 100%">
    <el-table-column label="编号" prop="id" />
    <el-table-column label="姓名" prop="name" />
    <el-table-column label="性别" prop="gender" />
    <el-table-column label="年龄" prop="age" />
    <el-table-column label="手机" prop="cellphone" />
    <el-table-column label="籍贯" prop="address" />
    <el-table-column align="right">
      <template #header>
        <el-input v-model="keyword" size="small" placeholder="搜索学生" />
      </template>
      <template #default="scope">
        <el-button size="small" >
          Edit
        </el-button>
        <el-button
            size="small"
            type="danger"
        >
          Delete
        </el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
export default {
  name: "StudentView",
  data(){
    return {
      students: [],
      keyword: ''
    }
  },
  methods:{
    loadStudent(){
      this.$axios.get('/findStudents')
          .then(result => {
            if(result.data.code === 200){
              this.students = result.data.data;
            }
          })
    }
  },
  mounted() {
    this.loadStudent()
  }
}
</script>

<style scoped>

</style>